package com.ItemsRent.action;

import net.sf.json.JSONObject;

import com.ItemsRent.model.User;

public class Login2Action {
	
	private User user ;

	private String result ;
	
	private String username;
	private String password;
	
	
	public String getUsername() {
		return username;
	}

	public void setUsername(String username) {
		this.username = username;
	}

	public String getPassword() {
		return password;
	}

	public void setPassword(String password) {
		this.password = password;
	}

	public String getResult() {
		return result;
	}

	public void setResult(String result) {
		this.result = result;
	}

	public User getUser() {
		return user;
	}

	public void setUser(User user) {
		this.user = user;
	}
	
	public String test(){
		JSONObject jsonObject = new JSONObject();
		jsonObject.put("username", username);
		jsonObject.put("password", password);
		user = (User)JSONObject.toBean(jsonObject, User.class);
		System.out.println("Success: "+user.getPassword()+user.getUsername());
		JSONObject json = JSONObject.fromObject(user);
		result = json.toString();
		return result;
	}
}
